package com.imm.da.base.vm

import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy

/**
 * <p>------------------------------------------------------
 * <p> Copyright (C) 2021 zhangmz, All rights reserved.
 * <p> If there is technical discussion, you can contact zhangmz90@foxmail.com
 * <p>------------------------------------------------------
 * <p> des
 * <p>
 *
 * @author Created by Administrator
 * @date on 2021 2021/11/14 16:48
 */
@BindingAdapter("loadImage")
fun loadImage(view : ImageView, url : String){
    Glide.with(view.context).load(url).into(view)
}

@BindingAdapter("loadNoneImage")
fun loadNoneImage(view : ImageView, url : String){
    Glide.with(view.context).load(url)
        .skipMemoryCache(true)
        .diskCacheStrategy(DiskCacheStrategy.NONE)
        .into(view)
}

@BindingAdapter("loadImage")
fun loadImage(view : ImageView, resourceId : Int){
    Glide.with(view.context).load(resourceId).into(view)
}